<template>
  <div class="profile_collect_interview">
    <profile-title title="我收藏的面经"></profile-title>
    <scroll v-if="collectInterview.length != 0" class="content">
      <interview-classify :classify="collectInterview"></interview-classify>
    </scroll>
    <div v-else class="no_collect">还没有收藏面经，马上去收藏吧~</div>
  </div>
</template>

<script>
  import Scroll from "components/content/scroll/Scroll";
  import ProfileTitle from "../ProfileTitle";
  import InterviewClassify from "./InterviewClassify";

  import {myCollection} from "network/collect";

  export default {
    name: "ProfileCollectInterview",
    components: {
      Scroll,
      ProfileTitle,
      InterviewClassify,
    },
    data() {
      return {
        collectInterview: []
      }
    },
    created() {
      myCollection('articles', this.$store.state.userInfo.id).then(res => {
        if(res.data.code) {
          this.collectInterview = res.data.data
        }
      })
    },
    mounted() {
      this.$bus.$on('collectRefresh', () => {
        myCollection('articles', this.$store.state.userInfo.id).then(res => {
          if(res.data.code) {
            this.collectInterview = res.data.data
          }
        })
      })
    },
  }
</script>

<style scoped>
  .content {
    width: 790px;
    height: calc(100vh - 125px);
    background-color: #fff;
  }

  .no_collect {
    margin-top: 60px;
    color: #ccc;
    font-size: 18px;
    text-align: center;
  }
</style>
